

#include <vector>
#include <iterator>

#include "SDL.h"
#include "SDL_opengl.h"

#include "common.h"
#include "ShapeGroup.h"

using namespace std;

__BEGIN_NAMESPACE_DECL_

void
ShapeGroup::draw()
{
    // Save the current matrix onto the stack
    glPushMatrix();

    // Perform any scaling, rotations or translations defined for this group
    transform();

    // Draw the shapes in our group
    vector<Shape*>::iterator it;
    for (it = _group.begin(); it != _group.end(); ++it)
        (*it)->draw();

    // Restore the matrix from the stack
    glPopMatrix();
}

void
ShapeGroup::addShape (Shape *shape)
{
    _group.push_back(shape);
}

__END_NAMESPACE_DECL_
